//
//  HomeViewController.swift
//  AnShiPai
//
//  Created by 马瑜 on 2017/7/7.
//  Copyright © 2017年 马瑜. All rights reserved.
//

import UIKit

class HomeViewController: BaseViewController {

    
    
    @IBOutlet weak var transferView: UIView! // 甩单view
    @IBOutlet weak var underTakeView: UIView! // 接单view
    
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        addShadowView(transferView)
        addShadowView(underTakeView)
        addTapTransition(transferView)
        addTapTransition(underTakeView)
        
        
    }

    
    // 添加点击跳转事件
    fileprivate func addTapTransition(_ tranditionView: UIView) {
        let blockTap = BlockTap {[weak self] (tap) in
            if tranditionView == self?.transferView {
//                let transferVC = UIStoryboard.mainStoryboard?.instantiateViewController(withIdentifier: "TransferViewController") as! TransferViewController
                let transferVC = TabBarManager.transferTabbarWithNavigationStyle()
                self?.presentVC(transferVC)
//                self?.pushVC(transferVC)
            } else if tranditionView == self?.underTakeView {
//                let underTakeVC = UIStoryboard.mainStoryboard?.instantiateViewController(withIdentifier: "UndertakeViewController") as! UndertakeViewController
//                self?.pushVC(underTakeVC)
                let underTakeVC = TabBarManager.undertakeTabbarWithNavigationStyle()
                self?.presentVC(underTakeVC)
            }
        }
        tranditionView.addGestureRecognizer(blockTap)
    }
    
    
    // 添加阴影
    fileprivate func addShadowView(_ addView: UIView) {
        let shadowView = UIView.init(frame: addView.frame)
        view.addSubview(shadowView)
        shadowView.isUserInteractionEnabled = true
        shadowView.layer.shadowColor = UIColor(hexString: "f2f2f2")?.cgColor
        shadowView.layer.shadowOffset = CGSize(width: 1, height: 1)
        shadowView.layer.shadowOpacity = 1
        shadowView.layer.shadowRadius = 9
        shadowView.layer.cornerRadius = 9
//        shadowView.clipsToBounds = false
        shadowView.addSubview(addView)
    }


    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
